﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Volo.Abp.Domain.Entities;

namespace Volo.Abp.SqlSugarCore.Configs
{
    public class SugarAutoGeneratorTableOptions
    {
        private static List<Type> _entityTypes;

        static SugarAutoGeneratorTableOptions()
        {
            _entityTypes = new List<Type>(512);
        }

        public void Add(Type entityAssemblyType)
        {
            _entityTypes.AddRange(entityAssemblyType.Assembly.GetTypes().Where(e => typeof(IEntity).IsAssignableFrom(e)));
        }
        public List<Type> GetEntityTypes()
        {
            return _entityTypes;
        }

        private static bool _isCreateDatabase;
        public void CreateDatabase()
        {
            _isCreateDatabase = true;
        }

        public bool IsCreateDatabase()
        {
            return _isCreateDatabase;
        }
        public void DisCreateDatabase()
        {
            _isCreateDatabase = false;
        }
    }
}
